{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2023-11-22T12:18:35.281985200Z",
     "start_time": "2023-11-22T12:18:34.832241700Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "       movie_name  movie_box_split_unit movie_box_rate movie_avg_seat  \\\n0           拯救嫌疑人                904.27          39.4%           1.7%   \n1            无价之宝                496.16          21.6%           1.7%   \n2     饥饿游戏：鸣鸟与蛇之歌                319.74          13.9%           1.3%   \n3              红猪                116.75           5.0%           1.9%   \n4        志愿军：雄兵出击                 69.92           3.0%           2.4%   \n...           ...                   ...            ...            ...   \n2974         王牌二哈                  0.00          <0.1%             --   \n2975           险诈                  0.00          <0.1%             --   \n2976        踢球吧少年                  0.00          <0.1%             --   \n2977         猫狗武林                  0.00          <0.1%             --   \n2978    龙珠超：超级人造人                  0.00          <0.1%             --   \n\n     movie_avg_show  movie_show_count movie_show_count_rate    cur_date  \n0               2.6             82864                 28.5%  2023-11-21  \n1               2.2             54513                 18.7%  2023-11-21  \n2               2.0             43835                 15.1%  2023-11-21  \n3               2.3             14467                  4.9%  2023-11-21  \n4               2.7              6708                  2.3%  2023-11-21  \n...             ...               ...                   ...         ...  \n2974            0.0                 1                 <0.1%  2023-11-01  \n2975            0.0                 1                 <0.1%  2023-11-01  \n2976            0.0                 1                 <0.1%  2023-11-01  \n2977            0.0                 5                 <0.1%  2023-11-01  \n2978            0.0                 2                 <0.1%  2023-11-01  \n\n[2979 rows x 8 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>movie_name</th>\n      <th>movie_box_split_unit</th>\n      <th>movie_box_rate</th>\n      <th>movie_avg_seat</th>\n      <th>movie_avg_show</th>\n      <th>movie_show_count</th>\n      <th>movie_show_count_rate</th>\n      <th>cur_date</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>拯救嫌疑人</td>\n      <td>904.27</td>\n      <td>39.4%</td>\n      <td>1.7%</td>\n      <td>2.6</td>\n      <td>82864</td>\n      <td>28.5%</td>\n      <td>2023-11-21</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>无价之宝</td>\n      <td>496.16</td>\n      <td>21.6%</td>\n      <td>1.7%</td>\n      <td>2.2</td>\n      <td>54513</td>\n      <td>18.7%</td>\n      <td>2023-11-21</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>饥饿游戏：鸣鸟与蛇之歌</td>\n      <td>319.74</td>\n      <td>13.9%</td>\n      <td>1.3%</td>\n      <td>2.0</td>\n      <td>43835</td>\n      <td>15.1%</td>\n      <td>2023-11-21</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>红猪</td>\n      <td>116.75</td>\n      <td>5.0%</td>\n      <td>1.9%</td>\n      <td>2.3</td>\n      <td>14467</td>\n      <td>4.9%</td>\n      <td>2023-11-21</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>志愿军：雄兵出击</td>\n      <td>69.92</td>\n      <td>3.0%</td>\n      <td>2.4%</td>\n      <td>2.7</td>\n      <td>6708</td>\n      <td>2.3%</td>\n      <td>2023-11-21</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>2974</th>\n      <td>王牌二哈</td>\n      <td>0.00</td>\n      <td>&lt;0.1%</td>\n      <td>--</td>\n      <td>0.0</td>\n      <td>1</td>\n      <td>&lt;0.1%</td>\n      <td>2023-11-01</td>\n    </tr>\n    <tr>\n      <th>2975</th>\n      <td>险诈</td>\n      <td>0.00</td>\n      <td>&lt;0.1%</td>\n      <td>--</td>\n      <td>0.0</td>\n      <td>1</td>\n      <td>&lt;0.1%</td>\n      <td>2023-11-01</td>\n    </tr>\n    <tr>\n      <th>2976</th>\n      <td>踢球吧少年</td>\n      <td>0.00</td>\n      <td>&lt;0.1%</td>\n      <td>--</td>\n      <td>0.0</td>\n      <td>1</td>\n      <td>&lt;0.1%</td>\n      <td>2023-11-01</td>\n    </tr>\n    <tr>\n      <th>2977</th>\n      <td>猫狗武林</td>\n      <td>0.00</td>\n      <td>&lt;0.1%</td>\n      <td>--</td>\n      <td>0.0</td>\n      <td>5</td>\n      <td>&lt;0.1%</td>\n      <td>2023-11-01</td>\n    </tr>\n    <tr>\n      <th>2978</th>\n      <td>龙珠超：超级人造人</td>\n      <td>0.00</td>\n      <td>&lt;0.1%</td>\n      <td>--</td>\n      <td>0.0</td>\n      <td>2</td>\n      <td>&lt;0.1%</td>\n      <td>2023-11-01</td>\n    </tr>\n  </tbody>\n</table>\n<p>2979 rows × 8 columns</p>\n</div>"
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "df = pd.read_csv('../static/data/movie_box_rate.csv')\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "outputs": [
    {
     "data": {
      "text/plain": "                movie_box_split_unit\nmovie_name                          \n拯救嫌疑人                       44179.18\n无价之宝                        12154.24\n惊奇队长2                       10808.06\n河边的错误                        6553.70\n二手杰作                         6264.47\n...                              ...\n棉花糖和云朵妈妈1宝贝芯计划                  0.00\n永远的焦裕禄                          0.00\n浴血大别山                           0.00\n浴血誓言                            0.00\n龙骑侠                             0.00\n\n[369 rows x 1 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>movie_box_split_unit</th>\n    </tr>\n    <tr>\n      <th>movie_name</th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>拯救嫌疑人</th>\n      <td>44179.18</td>\n    </tr>\n    <tr>\n      <th>无价之宝</th>\n      <td>12154.24</td>\n    </tr>\n    <tr>\n      <th>惊奇队长2</th>\n      <td>10808.06</td>\n    </tr>\n    <tr>\n      <th>河边的错误</th>\n      <td>6553.70</td>\n    </tr>\n    <tr>\n      <th>二手杰作</th>\n      <td>6264.47</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>棉花糖和云朵妈妈1宝贝芯计划</th>\n      <td>0.00</td>\n    </tr>\n    <tr>\n      <th>永远的焦裕禄</th>\n      <td>0.00</td>\n    </tr>\n    <tr>\n      <th>浴血大别山</th>\n      <td>0.00</td>\n    </tr>\n    <tr>\n      <th>浴血誓言</th>\n      <td>0.00</td>\n    </tr>\n    <tr>\n      <th>龙骑侠</th>\n      <td>0.00</td>\n    </tr>\n  </tbody>\n</table>\n<p>369 rows × 1 columns</p>\n</div>"
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[['movie_name','movie_box_split_unit']].groupby('movie_name').sum().sort_values('movie_box_split_unit',ascending=False)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-11-22T12:20:23.069389500Z",
     "start_time": "2023-11-22T12:20:23.056395700Z"
    }
   },
   "id": "b9dad385b3b4b8d"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
